<template>
  <view :style="themeColor">
    <view class="page">
      <!-- #ifdef APP-PLUS -->
      <view class="flex benben-position-layout flex flex-wrap align-center articleDetails_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub articleDetails_fd0_0'>
          <view class='flex flex-wrap align-center articleDetails_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  articleDetails_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='articleDetails_fd0_0_c1_c0'>{{$t('文章详情')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end articleDetails_fd0_0_c0'>
            <image class='articleDetails_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"7.png"'
              @tap.stop="popupShow1702561453731=true"></image>
            <view class="articleDetails_fd0_0_c2_c1" @click.stop="like">
              <image v-if="dataDetails.is_like==0" class='articleDetails_fd0_0_c2_c1' mode="aspectFit"
                :src='STATIC_URL+"6.png"'></image>
              <image v-if="dataDetails.is_like==1" class='articleDetails_fd0_0_c2_c1' mode="aspectFit"
                :src='STATIC_URL+"999.png"'></image>
            </view>

          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!-- #endif -->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout articleDetails_flex_1">
        <text class='articleDetails_fd1_0'>{{dataDetails.title}}</text>
        <text class='articleDetails_fd1_1'>{{dataDetails.create_time}}</text>
        <jyf-parser class='articleDetails_fd1_2' :html="dataDetails.text | richTextFormat">
        </jyf-parser>
        <view class='flex flex-wrap align-center articleDetails_fd1_3'>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout articleDetails_flex_2">
        <view class='flex flex-wrap align-center articleDetails_fd2_0'>
          <image class='articleDetails_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"8.png"'></image>
          <text class='articleDetails_fd2_0_c1'>{{$t('共')}}</text>
          <text class='articleDetails_fd2_0_c1'>{{dataDetails.comment_sum}}</text>
          <text class='articleDetails_fd2_0_c1'>{{$t('条评论')}}</text>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout articleDetails_flex_3">
        <template v-for='(item,key0) in leaveList'>
          <view class='flex flex-wrap align-start articleDetails_fd3_0' :key='key0'>
            <image class='articleDetails_fd3_0_c0' mode="aspectFit" :src='item.user_avatar'></image>
            <view class='flex flex-direction flex-wrap align-start articleDetails_fd3_0_c1'>
              <text class='text-cut-2 articleDetails_fd3_0_c1_c0'>{{item.user_nickname}}</text>
              <text class='articleDetails_fd3_0_c1_c1'>{{item.create_time}}</text>
              <text class='articleDetails_fd3_0_c1_c2'>{{item.content}}</text>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->
      <view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex articleDetails_flex_4">
        <view class='flex flex-wrap align-center justify-between flex-sub articleDetails_fd4_0'>
          <view class='flex flex-wrap align-center flex-sub articleDetails_fd4_0_c0'>
            <image class='articleDetails_fd4_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"10.png"'></image>
            <input class='articleDetails_fd4_0_c0_c1' type="text" :placeholder="$t('说点什么…')" confirm-type="done"
              :maxlength="-1" placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx" v-model="content" />
          </view>
          <button class='articleDetails_fd4_0_c1' @tap.stop="evaluationContFunc()">{{$t('发布')}}</button>
        </view>

      </view>
      <view :style="{height: '100rpx'}"></view>
      <benben-popup v-model="popupShow1702561453731" :mask="true" :mask-close-able="false" mode='bottom' :z-index='999'>
        <!---分享flex布局开始-->
        <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
          <view class='flex flex-direction flex-wrap align-stretch articleDetails_fd5_0'>
            <view class='flex flex-wrap align-center justify-between articleDetails_fd5_0_c0'>
              <view class='flex flex-wrap align-center articleDetails_fd5_0_c0_c0'>
              </view>
              <view class='flex flex-wrap align-center justify-center articleDetails_fd5_0_c0_c1'>
                <text class='articleDetails_fd5_0_c0_c1_c0'>{{$t('分享到')}}</text>
              </view>
              <view class='flex flex-wrap align-center articleDetails_fd5_0_c0_c2'>
                <image class='articleDetails_fd5_0_c0_c2_c0' mode="aspectFit" :src='STATIC_URL+"100.png"'
                  @tap.stop="popupShow1702561453731=false"></image>
              </view>
            </view>
            <view class='flex flex-wrap align-center justify-around articleDetails_fd5_0_c1'>
              <view class='flex flex-direction flex-wrap align-center' @click="shareApp('1')">
                <image class='articleDetails_fd5_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"11.png"'></image>
                <text class='articleDetails_fd5_0_c1_c0_c1'>{{$t('微信好友')}}</text>
              </view>
              <view class='flex flex-direction flex-wrap align-center' @click="shareApp('1')">
                <image class='articleDetails_fd5_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"12.png"'></image>
                <text class='articleDetails_fd5_0_c1_c0_c1'>{{$t('朋友圈')}}</text>
              </view>
            </view>
          </view>
        </view>

        <!---分享flex布局结束-->

      </benben-popup>


    </view>
  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "popupShow1702561453731": false,
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "dataDetails": {
          "title": "",
          "img": "",
          "text": "",
          "aid": "",
          "create_time": "",
          "liuyan": ""
        },
        "leaveList": [],
        "content": "",
        "id": "1"
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },
      userInfo: {
        get() {
          return this.$store.state.userInfo
        },
        set() {
          this.$store.commit('updateUserInfo', value)
        },
      },
    },
    watch: {},
    onLoad(options) {
      let {
        id
      } = options
      if (id !== undefined) this.id = id
      this.getArticleFunc()
      this.getLeaveFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      shareApp(type) {
        let that = this
        let provider = ''
        let scene = ''
        if (type == 1) {
          provider = 'weixin'
          scene = 'WXSceneSession'
        } else if (type == 2) {
          provider = 'weixin'
          scene = 'WXSenceTimeline'
        }
        console.log(provider, scene, that.dataDetails.img, that.dataDetails.title)
        // let links = that.apartmentDetails.h5_share +
        //   `/pages/shouye/apartmentDetails/apartmentDetails?id=${that.apartmentDetails.aid}`
        // console.log(' that.apartmentDetails', links)
        uni.share({
          provider: provider,
          scene: scene,
          type: '0',
          imageUrl: that.dataDetails.img,
          title: '加拿大靈巖山寺APP',
          href: that.dataDetails.h5_share,
          success: function(res) {
            console.log('22222')
            console.log("success:" + JSON.stringify(res));
          },
          fail: function(err) {
            console.log("fail:" + JSON.stringify(err));
          }
        });
      },
      like() {
        console.log('userInfo', this.userInfo)
        this.$api.post(global.apiUrls.post658e5a928ad1e, {
          artcilelist_id: this.id
        }).then(res => {
          if (res.data.code == 1) {
            this.$message.info(res.data.msg)
            this.getArticleFunc()
          }
        })
      },
      //获取文章详情
      async getArticleFunc() {
        //请求方法
        //数据验证

        let datadataDetails = await this.$api.post(global.apiUrls.post658bf39e1bd4a, {
          aid: this.id,
          user_id: this.userInfo ? this.userInfo.id : ''
        });

        if (datadataDetails.data.code != 1) {
          this.$message.info(datadataDetails.data.msg);
          return
        }
        let infodataDetails = datadataDetails.data;
        this.dataDetails = infodataDetails.data

      },
      //获取留言列表
      getLeaveFunc() {
        this.minixPagingListsApi = global.apiUrls.post658bf3d5ce44f;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          artcilelist_id: this.id,
          user_id: this.userInfo ? this.userInfo.id : ''
        }
        this.listData = [];
        this.leaveList = this.listData;
        this.pagingListToggle();

      },
      //评价内容
      async evaluationContFunc() {
        if (!validate(this.content, 'require')) {
          this.$message.info(global.i18n.t('请填写内容'));
          return false;
        }
        //请求方法
        //数据验证

        let data656051d2dd1b1 = await this.$api.post(global.apiUrls.post656051d2dd1b1, {
          content: this.content,
          artcilelist_id: this.id
        });

        if (data656051d2dd1b1.data.code != 1) {
          this.$message.info(data656051d2dd1b1.data.msg);
          return
        }



        this.$message.info('评价成功');
        this.content = '';
        setTimeout(() => {
          this.getArticleFunc()
          this.getLeaveFunc()
        }, 500)
      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(247, 243, 237, 1);
    background-size: 100% auto;
  }

  .articleDetails_flex_0 {
    border-bottom: 1px solid rgba(238, 238, 238, 1);
    background: rgba(247, 243, 237, 1);
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .articleDetails_fd0_0_c2_c1 {
    width: 42rpx;
    height: 42rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .articleDetails_fd0_0_c2_c0 {
    width: 42rpx;
    height: 42rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 32rpx 0rpx 0rpx;
  }

  .articleDetails_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .articleDetails_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .articleDetails_fd0_0_c0 {
    width: 160rpx;
  }

  .articleDetails_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .articleDetails_flex_1 {
    padding: 25rpx 32rpx 0rpx 32rpx;
  }

  .articleDetails_fd1_3 {
    background: rgba(235, 228, 217, 1);
    margin: 32rpx 0rpx 0rpx 0rpx;
    background-size: 100% auto;
    border-radius: 10rpx;
    height: 20rpx;
  }

  ::v-deep .articleDetails_fd1_2 {
    width: 100%;
  }

  .articleDetails_fd1_1 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
    margin: 24rpx 0rpx 24rpx 0rpx;
  }

  .articleDetails_fd1_0 {
    color: #333333;
    font-size: 32rpx;
    font-weight: 600;
    line-height: 54rpx;
  }

  .articleDetails_flex_2 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    margin: 32rpx 0rpx 0rpx 0rpx;
  }

  .articleDetails_fd2_0_c1 {
    color: #202020;
    font-size: 32rpx;
    font-weight: 500;
    line-height: 32rpx;
  }

  .articleDetails_fd2_0_c0 {
    width: 30rpx;
    height: 32rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .articleDetails_fd2_0 {
    border-bottom: 1px solid #eee;
    padding: 0rpx 0rpx 24rpx 0rpx;
  }

  .articleDetails_flex_3 {
    padding: 32rpx 32rpx 0rpx 32rpx;
  }

  .articleDetails_fd3_0_c1_c2 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 32rpx;
    margin: 16rpx 0rpx 0rpx 0rpx;
    width: 550rpx;
  }

  .articleDetails_fd3_0_c1_c1 {
    color: #999999;
    font-size: 22rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .articleDetails_fd3_0_c1_c0 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 32rpx;
    width: 550rpx;
  }

  .articleDetails_fd3_0_c1 {
    margin: 0rpx 0rpx 0rpx 16rpx;
  }

  .articleDetails_fd3_0_c0 {
    width: 56rpx;
    height: 56rpx;
    border-radius: 50%;
  }

  .articleDetails_fd3_0 {
    margin: 0rpx 0rpx 40rpx 0rpx;
  }

  .articleDetails_flex_4 {
    background: rgba(0, 0, 0, 0.06);
    width: 750rpx;
    height: 100rpx;
    overflow: hidden;
    z-index: 10;
    bottom: calc(0rpx + var(--window-bottom));
    background-size: 100% auto;
  }

  .articleDetails_fd4_0_c1 {
    background: rgba(145, 47, 34, 1);
    border-radius: 44rpx;
    width: 112rpx;
    line-height: 72rpx;
    font-size: 28rpx;
    color: #fff;
  }

  .articleDetails_fd4_0_c0_c1 {
    margin: 0rpx 0rpx 0rpx 8rpx;
  }

  .articleDetails_fd4_0_c0_c0 {
    width: 24rpx;
    height: 26rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .articleDetails_fd4_0_c0 {
    background: rgba(255, 255, 255, 1);
    margin: 0rpx 24rpx 0rpx 0rpx;
    border-radius: 36rpx;
    background-size: 100% auto;
    padding: 16rpx 24rpx 16rpx 24rpx;
  }

  .articleDetails_fd4_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .articleDetails_fd5_0_c1_c0_c1 {
    font-size: 24rpx;
    font-weight: 400;
    color: #333;
  }

  .articleDetails_fd5_0_c1_c0_c0 {
    width: 80rpx;
    height: 80rpx;
    border-radius: 40rpx 40rpx 40rpx 40rpx;
    margin: 0rpx 0rpx 16rpx 0rpx;
  }

  .articleDetails_fd5_0_c1 {
    padding: 0rpx 0rpx 58rpx 0rpx;
  }

  .articleDetails_fd5_0_c0_c2_c0 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
  }

  .articleDetails_fd5_0_c0_c2 {
    margin: 0rpx 2rpx 0rpx 0rpx;
  }

  .articleDetails_fd5_0_c0_c1_c0 {
    font-size: 32rpx;
    font-weight: 400;
    color: #333333;
    margin: 0rpx 16rpx 0rpx 16rpx;
    line-height: 46rpx;
  }

  .articleDetails_fd5_0_c0_c1 {
    padding: 40rpx 0rpx 48rpx 0rpx;
  }

  .articleDetails_fd5_0_c0_c0 {
    width: 40rpx;
  }

  .articleDetails_fd5_0_c0 {
    padding: 0rpx 13rpx 0rpx 0rpx;
  }

  .articleDetails_fd5_0 {
    background: #fff;
    background-size: 100% auto !important;
    border-radius: 24rpx 24rpx 0rpx 0rpx;
    padding: 0rpx 32rpx 0rpx 32rpx;
  }
</style>
